package com.eportal.action.background;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;

import com.eportal.action.BaseAction;
import com.eportal.domain.TKeys;
import com.eportal.domain.UsersEnjoy;
import com.eportal.service.TUsersService;
import com.eportal.service.UsersEnjoyService;
import com.framework.jqgrid.JqGridPager;
import com.opensymphony.xwork2.ModelDriven;

/**
 * 乐享管理
 * @author chencheng
 *
 */
public class UsersEnjoyAction extends BaseAction implements ModelDriven<UsersEnjoy> {

    /**
	 * @author chencheng
	 */
	private static final long serialVersionUID = 1L;

	private static Logger log = Logger.getLogger(UsersEnjoyAction.class.getName());

    private Map<String, Object> result = new HashMap<String, Object>();

    @Autowired
    UsersEnjoyService usersEnjoyService;
    
    /**
     * 乐享列表
     */
    public void usersEnjoyList() throws Exception {
	   	 String userId = getRequest().getParameter("userId");
	   	 result = usersEnjoyService.UsersEnjoyList(userId);
         responseBody(result);
    }
    
    /**
     * 乐享置顶或取消置顶操作
     */
    public void enjoyTop(){
    	String userid = getRequest().getParameter("userid");
    	String communityid = getRequest().getParameter("communityid");
    	String status = getRequest().getParameter("status");
    	result = usersEnjoyService.enjoyTopMethod(userid,communityid,status);
        responseBody(result);
    }
    
    
    
    /**
     * 乐享清空
     */
    public void cleanEnjoy() {
    	try {
    		String userid = getRequest().getParameter("userid");
    		result = usersEnjoyService.cleanEnjoyMethod(userid);
		} catch (Exception e) {
			result.put("code", 0);
            result.put("msg", "乐享清空失败");
            log.error(this, e);
		}
    	responseBody(result);
    }
    

    
    private UsersEnjoy usersEnjoy = new UsersEnjoy();

    @Override
    public UsersEnjoy getModel() {
        return usersEnjoy;
    }
}
